<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" href="../css/style.css"/>
<link rel="stylesheet" type="text/css" href="../css/sty.css"/>
<title>Tin ẩn</title>
</head>

<body>
<div id="wrapper">
<div id="header">
     <div id="top-header" class="clearfix">
        <a href="#" id="logo" class="clearfix"><img src="../images/4468766.jpg" width="100" height="60" />
       <h3>Tin Từng Giây</h3></a>
 </div>
  <br />
</div>
<hr />
<br />
<center><p style="color: #3C9; font-size:24px">TRANG QUẢN TRỊ VIÊN - TIN TỪNG GIÂY<br />
<br />
<div style="width:815.5px" id="menu">
     <ul class="clearfix">
	 <li class="active"><a href="dn.php?trang=thanhvien">Quản lý thành viên</a></li>
     <li class="active"><a href="dn.php?trang=editor">Quản lý biên tập viên</a></li>
     <li class="active"><a href="dn.php?trang=tinhienthi">Quản lý tin hiện thị</a></li>
     <li class="active"><a href="dn.php?trang=tinan">Quản lý tin ẩn</a></li>
     <li class="active"><a href="dn.php?trang=quangcao">Quản lý quảng cáo</a></li>
     <li class="active"><a href="dn.php?trang=binhluan">Quản lý bình luận</a></li></ul></div></center><br />
<br />
<table style="margin-left: 20px" width="600" border="1">
  <tr>
    <th height="23" scope="col">STT</th>
    <th scope="col">Tiêu đề</th>
    <th scope="col">Thể loại</th>
	<th scope="col">Người đăng</th>
    <th scope="col">Ngày đăng</th>
    <th scope="col">Thao tác</th>
  </tr>
  <?php
	  include('mysql.php');
	if(isset($_POST['hientin'])){
		$tieude=$_POST['hientin'];
		$r="update tintuc set Anhienthi=1 where 
		Tieude='$tieude'";
		$q=mysqli_query($dbc,$r) or die(mysqli_error($dbc));
		if(mysqli_affected_rows($dbc)){
				echo "<script>alert('Thao tác hiện thị thành công');</script>";
		}
	}
?>
<?php
	if(isset($_POST['xoatin'])){
		$tieude=$_POST['xoatin'];
		$r="delete from tintuc where Tieude='$tieude'";
		$q=mysqli_query($dbc,$r) or die(mysqli_error($dbc));
		if(mysqli_affected_rows($dbc)){
				echo "<script>alert('Thao tác Xóa thành công');</script>";
		}
	}
?>
<?php
	$r="select b.tenTL,a.Tieude,a.Tomtat,c.TenDN,a.ngaydang from tintuc as a,theloai as b,user as c where a.IDtheloai=b.IDtheloai and a.IDUser=c.IDUser and a.Anhienthi=0";
	$q=mysqli_query($dbc,$r);
	$dem=1;
	while($row=mysqli_fetch_array($q)){
?>
<script>
	function anhien(id,layten){
		var tieude=document.getElementById(layten).value;
		document.getElementById(id).value=tieude;
		document.getElementById(id,layten)
		tieude.style.Color = red;
	}
	
</script>
  <tr>
    <td height="46"><?php echo $dem?></td>
    <td><input id="tieude<?php echo $dem; ?>" readonly="readonly" value="<?php echo $row['Tieude']; ?>" on="mau()"/></td>
    <td><?php echo $row['tenTL']; ?></td>
    <td><?php echo $row['TenDN']; ?></td>
    <td><?php echo $row['ngaydang']; ?></td>
    <td>
            <form style="text-align:center" id="form2" name="form2" method="post">
            
            <input type="hidden" name="hientin" id="hientin<?php echo $dem;?>" />
            <input type="hidden" name="xoatin" id="xoatin<?php echo $dem;?>" />
            
                   <input type="submit" name="button" id="xoa<?php echo $dem;?>" onmousemove="anhien(id='hientin<?php echo $dem;?>',layten='tieude<?php echo $dem;?>')" value="Hiện Thị tin" />
                    <input type="submit" name="button" id="xoa<?php echo $dem;?>" onmousemove="anhien(id='xoatin<?php echo $dem;?>',layten='tieude<?php echo $dem;?>')" value="Xóa tin" />
          
            </form></td>
  </tr>
  <?php $dem++;  } ?>
</table>



</body>
</html>



